package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.dto.SupplierManageBindingSpecsGetSupplyNameDTO;
import com.sc.nft.entity.SupplierManageBinding;
import com.sc.nft.mapper.SupplierManageBindingMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 供应商和商品绑定(SupplierManageBinding)表Dao层
 *
 * @author 王伟成
 * @since 2023-10-17 15:29:50
 */
@Slf4j
@Repository
public class SupplierManageBindingDao extends ServiceImpl<SupplierManageBindingMapper, SupplierManageBinding> {


    public SupplierManageBinding getMallId(Long mallId) {
        LambdaQueryWrapper<SupplierManageBinding> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(SupplierManageBinding::getMallId,mallId);
        return getOne(lambdaQueryWrapper);
    }

    public List<SupplierManageBinding> getList() {
        return list();
    }

    public List<SupplierManageBindingSpecsGetSupplyNameDTO> getSupplyNameByProductIdList(List<Long> productIdList) {
        return baseMapper.getSupplyNameByProductIdList(productIdList);
    }
}
